package com.zhan.ielts.dao.impl.speakingmodify;

import com.zhan.frame.core.dao.impl.BaseDaoImpl;
import com.zhan.frame.core.utils.BeanUtils;
import com.zhan.ielts.dao.speakingmodify.SpeakingModifyQustionDao;
import com.zhan.ielts.domain.speakingmodify.SpeakingModifyQuestion;
import com.zhan.ielts.domain.vo.speakingmodify.SpeakingModifyQuestionVo;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * Created by tlfu on 2017/1/10.
 */
@Repository
public class SpeakingModifyQustionDaoImpl extends BaseDaoImpl<SpeakingModifyQuestion> implements SpeakingModifyQustionDao {
    @Override
    public List<SpeakingModifyQuestionVo> selectVos(SpeakingModifyQuestion question, Pageable pageable) {
        Map map =getParams(question,pageable);
        map.put("sorting","`publish_time` DESC");
        return sqlSessionTemplate.selectList(getSqlName("selectVos"),map);
    }

    @Override
    public Long selectVosCount(SpeakingModifyQuestion question) {
        Map map = BeanUtils.toMap(question);
        return sqlSessionTemplate.selectOne(getSqlName("selectVosCount"), map);
    }
}
